﻿@model LeadVinaglue.Models.ViewPages.ProductManagementModel
           
@{
    ViewBag.Title = "Thêm mới tài liệu";
    Layout = "~/Views/Shared/_Layout.MyAccount.cshtml";
}
<form method="post" class="form" action="/MyAccount/ProductList/Add">
	<fieldset id="apps">
		<h2 class="app">
	        <strong>Thêm mới tài liệu</strong>
        </h2>
		<div class="errorMessage" data-bind="visible: InvalidateForm" >
			<span class="error">Xin hãy nhập thông tin bên dưới chính xác.</span>
		</div>				
		<div class="title nomargin">
			<h3>Thông tin</h3>
		</div>
                
        <!-- Error messages -->
        <div id="errorMessages" style="display:none;">
			<span class="errorgrid">                            
            </span>
		</div>
        <div class="clear"></div>

        <div id="groupfields" class="panel grouped-form">
        <!-- Group 1 -->
            <ul id="tab1" class="accordeon-tabs accordeon-2">
                <li class="open">
                    <h3>Thông tin chung</h3>
                    <span class="panel">
                        <div class="col ident" style="width:450px">                        
                            <div class="row">
					            <label for="text1">Tiêu đề:</label>
					            <input class="text" type="text" style="width:350px" data-bind="value: Title, attr:{maxlength:250}" name="Title" />
				            </div>  
                            <div class="row">                        
					            <label for="text12">Danh mục:</label>
                            </div>  
                            <div class="row"> 
                                <select id="CategoryID" name="CategoryID" data-bind="value: CategoryID, foreach: CategoryList">
                                    <option data-bind="value: ID, text: Name"></option>
                                </select>
                            </div>
                            <div class="row">              
					            <label for="text12">Danh mục con:</label>
                            </div>  
                            <div class="row"> 
                                <select id="SubCategoryID" name="SubCategoryID" data-bind="value: SubSelectedID, foreach: SubCategoryList">
                                    <option data-bind="value: ID, text: Name"></option> 
                                </select>
                            </div>             
                            <div class="row">              
					            <label for="text12">Ngôn ngữ:</label>
                            </div>  
                            <div class="row"> 
                                <select id="LanguageId" name="LanguageId" data-bind="value: LanguageId, foreach: LanguageList">
                                    <option data-bind="value: LanguageId, text: Title"></option> 
                                </select>
                            </div>
                            <div class="row">
					            <label for="text12">Loại tài liệu:</label>
                            </div>
                            <div class="row">
                                <select id="TypeId" name="TypeId" data-bind="value: TypeId, foreach: DocumentTypeList">
                                    <option data-bind="value: TypeId, text: Title"></option> 
                                </select>
                            </div>
                            <div class="row">Mô tả</div>
                            <div class="row">
				                <textarea id="elm2" class="text" rows="7" style="width: 400px;" data-bind="value: LongDesc" name="LongDesc">
                                </textarea>
			                </div>
                        </div>
                        <div class="col">     
                            <div id="editform" class="row">
					            <label for="text12">Chia sẻ:</label>
                                <div class="groupinput" style="width: 100px">
                                    <input type="checkbox" data-bind="checked: IsPublic" name="IsPublic" />
                                </div>					    
				            </div>      
                            <div class="row"><label>Ảnh đại diện (<= 100Kb)</label></div>
                            <div class="row">
                                <img alt="logo" data-bind="attr: {src: ImagePath}" />
                                <input type="hidden" name="ImageUrl" data-bind="value: ImageName" />
                            </div>  
                            <div class="row">
						        <input type="file" name="fileData" id="fileData" class="btn btn-choose-file"  />
					        </div>
                              
                            <div class="row" style="margin-top:30px">
                                <label>Tài liệu đính kèm</label>
                                <span data-bind="text: OriginalAttachName"></span>
                            </div>
                            <div class="row">
                                <input type="hidden" name="FileName" data-bind="value: AttachName" />
                                <input type="hidden" name="FileType" data-bind="value: AttachType" />
                            </div>  
                            <div class="row">
						        <input type="file" name="fileAttach" id="fileAttach" class="btn btn-choose-file"  />
					        </div>
                        </div>
                          
                        <div class="clear"></div>   
                    </span>
                </li>
            </ul>
        </div>

		<div class="title nomargin end">
            <span class="left-btns">
                <a class="btn btn-cancel" href="/MyAccount/ProductList" title="Trở về trang quản lý">cancel</a>
            </span>
            <span class="right-btns">
                <a class="btn btn-submit-page" id="submit" href="##" data-bind="click: SubmitForm" title="Đăng tin ngay">submit</a>
            </span>
		</div>
	</fieldset>
</form>
<script type="text/javascript">
    var data = @(Html.Raw(Json.Encode(Model)));
</script>
<script src="/TinyMCE/tiny_mce.js" type="text/javascript"></script>
<script src="/TinyMCE/tinymce.init.js" type="text/javascript"></script>
<script src="/Scripts/Client/ProductAddEx.js" type="text/javascript"></script>
<script src="/Scripts/Library/jquery.uploadify.js" type="text/javascript"></script>
<script src="/Scripts/Client/uploadfile.js" type="text/javascript"></script>
